﻿using AdminBase.Model.Entitys;
using Newtonsoft.Json;
using SqlSugar;

namespace AdminBase.Model
{
    /// <summary>
    /// 权限数据传输模型
    /// </summary>
    public class PermissionsDto : Permissions
    {
        /// <summary>
        /// 重写ID赋值tree特性
        /// </summary>
        [SugarColumn(IsTreeKey = true)]
        [JsonProperty("id")]
        public long ID { get; set; }

        /// <summary>
        /// 文本
        /// </summary>
        [JsonProperty("label")]
        [SugarColumn(IsIgnore = true)]
        public string Label => base.Name;

        /// <summary>
        /// 子级
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        [JsonProperty("children")]
        public List<PermissionsDto>? Children { get; set; }
    }
}
